In [13]:
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as pt
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot(style='k--')
In [ ]:
pd.stats.moments.rolling_mean(ts, 60).plot(style='k')
In [ ]:
pd.stats.moments.rolling_apply(ts, 60, np.std).plot(style='k')
In [ ]: